<?php
include_once('./inc/config.php');
$aw_code = $_POST['aw_code'];
//$site_details = $_POST['site_details'];

$query = "SELECT d_id
		FROM `domains`
		WHERE
		c_code = '".addslashes($aw_code)."'";
	
// Perform Query
$result = mysql_query($query);

// Gwet num rows from the result set	
$no_rows = mysql_num_rows($result);	

$status_msg = 0;
if($no_rows > 0 && isset($_POST['location_href']))
{
	$query = "INSERT INTO `total_time_on_page` (
	`an_id` ,
	`an_code` ,
	`an_created`,
	`location_href`,
	`location_pathname`,
	`total_time`
	)
	VALUES (
	NULL , '".addslashes($aw_code)."','".date("Y-m-d H:i:s")."',	
	'".addslashes($_POST['location_href'])."',
	'".addslashes($_POST['location_pathname'])."',
	'".$_POST['total_time']."'
	)";
	//echo 'insert>>'.$query;
	$result = mysql_query($query);	
	$status_msg = 1;//success
}

echo $status_msg;
?>